package com.example.springboot.entity;

import cn.hutool.core.annotation.Alias;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.List;

@Data
@TableName("comment")
public class Comment {

    @TableId(type=IdType.AUTO)
    private Integer id;
    private String content;
    private Integer rootId;
    private Integer pid;
    private Integer userId;
    private Integer replyUserId;
    private String time;
    private Integer fid;
    private Integer level;

    @TableField(exist = false)
    private String username; // 评论用户昵称

    @TableField(exist = false)
    private String userAvatar; // 评论用户头像

    @TableField(exist = false)
    private String replyUsername; // 被回复用户昵称

    @TableField(exist = false)
    private List<Comment> children; // 子评论列表（树形结构用）

    @TableField(exist = false)
    private boolean expand = true; // 前端控制子评论展开/折叠

}
